home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93b.txt
/
000067_icon-group-sender _Fri May 7 20:55:51 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-06-16
|
3KB
Received: by cheltenham.cs.arizona.edu; Sat, 8 May 1993 05:49:45 MST
Date: 7 May 93 20:55:51 GMT
From: uchinews!ellis!goer@migs.ucar.edu (Richard L. Goerwitz)
Organization: University of Chicago
Subject: Re: runtime debugger and the Icon fan club.
Message-Id: <1993May7.205551.1831@midway.uchicago.edu>
References: <9304281927.AA17778@roll.csd.sgi.com>, <1993Apr29.141749.24949@midway.uchicago.edu>, <1993May7.182643.26824@netlabs.com>
Sender: icon-group-request@cs.arizona.edu
To: icon-group@cs.arizona.edu
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
lwall@netlabs.com (Larry Wall) writes:
>
>: [Icon programmers] mainly use the semicolon to separate two expres-
>: sions abutted on the same line. Generally it is lacking from idiomatic
>: Icon code, and with good reason: It is generally superfluous even in
>: languages that force one to use it!
>
>Not to contradict a valid assertion, but as a point of interest it's
>not superfluous in Perl, since it switches the lexer from expecting an
>operator to expecting a term, just as any other operator would.
So, for example, if we see INTEGER 1, then OP '*', then INTEGER 1, if
we then see a ';' the lexer knows that the next thing is not going to be an
operator? Maybe I'm not understanding, but wouldn't a newline accom-
plish the same thing?
1 * 1;
2 * 2...
vs.
1 * 1
2 * 2...
Let's suppose I have a prefix operator '*' - the same string as the binary,
right associative multiplication operator. Will there be any problem
inserting semicolons? Not normally. The third example below might
pose a problem if we are simply *omitting* newlines and semicolons. But
the Icon tokenizer does not omit semicolons. It inserts one if the end
of every line that happens to coincide with the end of an expression:
1) a * b * c
2) a * * b
3) a * b
* a * b
The natural way our eyes group 3 is the way Icon's tokenizer groups it,
too. The only problem with this method of handling semicolons is that
you have to be careful not to break up expressions in such a way that
the first part could be an expression. For example if you want to say
"a * b * c", then the following isn't a valid way of expressing this in
using an Icon like system of semicolon insertion:
4) a * b
* b
(4) is, of course, terrible programming style, if a * b * c is intended.
Occasionally, an Icon beginner (i.e. someone who doesn't yet have a feel
for what Icon expressions should look like) will make mistakes like (4).
These, however, are quickly remedied. I can't recall grouping something
wrong in this way for over five years (and I've used Icon for less than
six years, I think).
Bottom line: Icon doesn't omit semicolons. Rather it inserts them ac-
cording to a simple algorithm that lets the user pretty much forget about
inserting them him or herself.
--
-Richard L. Goerwitz goer%midway@uchicago.bitnet
goer@midway.uchicago.edu rutgers!oddjob!ellis!goer